<!--
 * @Author: 张帆 zhangfan@jxtech.net
 * @Date: 2022-06-30 10:06:01
 * @LastEditors: 张帆 zhangfan@jxtech.net
 * @LastEditTime: 2024-09-25 10:36:23
 * @FilePath: /vue3_test/src/components/demo.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE==
-->
<template>
  <button @click="testGlobalProperties">全局弹窗测试</button>
</template>

<script>
import { reactive, onMounted  } from "vue"
import instance from '../hooks/instance.js'
export default {
  name: "demo",
  setup() {
    onMounted(() => {
      init.instanceObj = instance()
    });

    let init = reactive({
      instanceObj: {}
    })

    const testGlobalProperties = async () => {
      // throw(err) // 测试抛错
      console.log('init.instanceObj==', init.instanceObj)
      const { global, proxy } = init.instanceObj
      const confirm = await global.$myConfirm('确定删除该数据吗?')
      // await global.$message({
      //     message: '成功',
      //     type: 'success'
      // })
      console.log('confirm==', confirm)
      console.log('proxy==', proxy)
    }

    return {
      init,
      testGlobalProperties
    };
  },
};
</script>


